﻿using BCAMap.AMap.Dto;
using BCCommon;
using BCCommon.Enums.TMS;
using BCDto.Common.ErrorMessage;
using BCDto.MallInterface;
using BCDto.TMS.MallInterface;
using BCService.MallInterface;
using BCTMSRESTful.Configs;
using BCTMSRESTful.Controllers.Management;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;


namespace BCTMSRESTful.Controllers.Management.TMS.MallInterface
{
    /// <summary>
    /// 商城接口
    /// </summary> 
    [ApiExplorerSettings(GroupName = "TMSAdmin")]
    [Route("api/v1/sim/[controller]")]
    public class MallInterfaceController : ManagementBaseController
    {
        #region var
        private IMallInterfaceService  mallInterfaceService;

        #endregion


        #region 构造函数
        public MallInterfaceController(IMallInterfaceService mallInterfaceService)
        {
            this.mallInterfaceService = mallInterfaceService;
        }
        #endregion


        #region POST 计算运费  
        /// <summary>
        /// 计算运费
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [Log("计算运费")]
        [HttpPost("[action]")]
        [ProducesResponseType(typeof(MallOrderResposeDto), 200)]
        public IActionResult CostCalc([FromBody] MallOrderDto dto)
        {
            var a = mallInterfaceService.CostCalc(dto);
            return Ok(a);
        }

        #endregion

        #region POST 订单确认  
        /// <summary>
        /// 订单确认
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [Log("订单确认")]
        [HttpPost("[action]")]
        [ProducesResponseType(typeof(MallOrderConfirmResposeDto), 200)]
        public IActionResult ConfirmOrder([FromBody] MallOrderConfirmDto dto)
        {
            var a = mallInterfaceService.ConfirmOrder(dto);
            return Ok(a);
        }

        #endregion

    }
}
